#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int countKeyChanges(string s) {
        int res = -1;
        char prev = ' ';
        for (auto c : s)
        {
            if (c >= 'A' && c <= 'Z') c += ('a' - 'A');
            if (prev != c)
            {
                prev = c;
                ++res;
            }
        }
        return res;
    }
};